package app.species;

import java.awt.geom.Dimension2D;

import sim.engine.*;
import sim.portrayal.LocationWrapper;
import sim.util.*;

public class StationaryFood extends Entity{

	/**
	 * 
	 */
	private static final long serialVersionUID = -8618892599047401620L;
	
	@Parameter(name="STATIONARYFOOD_DEFAULT_DIAMETER")
	private static double DEFAULT_DIAMETER = 75.0;
	
	@Parameter(name="STATIONARYFOOD_DEFAULT_SENSE_DIST")
	private static double DEFAULT_SENSE_DIST = 75.0;
	
	@Parameter(name="STATIONARYFOOD_DEFAULT_SPEED")
	private static double DEFAULT_SPEED = 10.0;
	
	@Parameter(name="STATIONARYFOOD_DEFAULT_LIFE_SPAN")
	private static int DEFAULT_LIFE_SPAN = 0;
	
	@Parameter(name="STATIONARYFOOD_ENERGY")
	private static int energyAddedToCreature = 500;
	
	

	public StationaryFood(MutableDouble2D initPos, MutableDouble2D initHead){

		super(initPos, initHead);

		this.setDiameter(StationaryFood.DEFAULT_DIAMETER);
		this.setSenseDistance(StationaryFood.DEFAULT_SENSE_DIST);
		this.setSpeed(StationaryFood.DEFAULT_SPEED);
		this.setLifeSpan(StationaryFood.DEFAULT_LIFE_SPAN);

		this.resetColor();

		// WILL CHANGE!!!!!!
		this.setEnergy(StationaryFood.energyAddedToCreature);

	}

	public StationaryFood(){ super(); }

	public static void setDefaults(double diameter, double speed, double senseDist, int lifeSpan){

		StationaryFood.DEFAULT_DIAMETER = diameter;
		StationaryFood.DEFAULT_SPEED = speed;
		StationaryFood.DEFAULT_SENSE_DIST = senseDist;
		StationaryFood.DEFAULT_LIFE_SPAN = lifeSpan;

	}

	public static void setEnergyAddedToCreature(int n){
		StationaryFood.energyAddedToCreature = n;
	}

	/* does nothing, because food does not move
	 **/
	public void step(SimState state){

		SpeciesSim sim = (SpeciesSim)state;

		if(this.getAge() > this.getLifeSpan()){
			sim.removeEntityFromSim(this, sim.stationaryFood);
			return;
		}

		this.incrementAge();

	}

}
